﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Benefit.Service.ServerData
{
    /// <summary>
    /// 经纪公司表
    /// </summary>
    public class ServiceT_BrokenAddr : Benefit.Interface.ServerData.IT_BrokenAddr
    {
        Benefit.DB.DBManager db = null;
        public ServiceT_BrokenAddr(Benefit.DB.DBManager db)
        {
            this.db = db;
        }

        /// <summary>
        /// 得到所有经纪公司代码和名称
        /// </summary>
        /// <returns></returns>
        public List<Models.ServerData.T_BrokenAddr> GetList()
        {
            DavidDB.ADO.DBManager dbmanager = new DavidDB.ADO.DBManager();
            string sql = "select distinct BrokenName,BrokenId from T_BrokenAddr";
            dynamic sdr = dbmanager.ExecuteReader(sql);
            List<Models.ServerData.T_BrokenAddr> a = new List<Models.ServerData.T_BrokenAddr>();
            while (sdr.Read())
            {
                Models.ServerData.T_BrokenAddr b = new Models.ServerData.T_BrokenAddr();
                b.BrokenId = sdr["BrokenId"].ToString();
                b.BrokenName = sdr["BrokenName"].ToString();
                a.Add(b);
            }
            sdr.Close();
            dbmanager.Commit();
            dbmanager.Dispose();
            return a;
        }


    }
}
